import java.io.*;
import java.util.Enumeration;
import javax.microedition.io.Connection;
import javax.microedition.io.Connector;
import javax.microedition.io.file.*;

public final class Cls_6
    implements FileSystemListener
{

    private boolean fld_50;
    private Object fld_51[];
    private int fld_52;

    public final Object[] mth_49(int i)
    {
        FileConnection fileconnection;
        DataInputStream datainputstream;
        Object aobj[];
        if(i == fld_52)
            return fld_51;
        fld_52 = i;
        fld_51 = null;
        i = Cls_16.fld_263.mth_663(i);
        fileconnection = null;
        datainputstream = null;
        aobj = null;
        i;
        mth_58();
        JVM INSTR dup ;
        fileconnection;
        openDataInputStream();
        datainputstream;
        i = new byte[4];
        for(int j = 0; (j += datainputstream.read(i, j, 4 - j)) < 4;);
        if(Cls_16.mth_677(i, 0) != 0x2d35510)
        {
            Cls_16.mth_249(datainputstream);
            mth_66(fileconnection);
            return null;
        }
        datainputstream;
        3;
        Cls_16.mth_237();
        if(datainputstream.read() != 15)
        {
            Cls_16.mth_249(datainputstream);
            mth_66(fileconnection);
            return null;
        }
        datainputstream;
        10;
        Cls_16.mth_237();
        String s;
        byte abyte0[];
        i = datainputstream.readUTF();
        short word0;
        abyte0 = new byte[word0 = datainputstream.readShort()];
        datainputstream.readFully(abyte0, 0, word0);
        if(word0 == 0)
            abyte0 = null;
        s = datainputstream.readUTF();
        String s1;
        if((s1 = datainputstream.readUTF()) != null && s1.length() > 0 && s1.charAt(0) == 0)
            s = s + s1.substring(1, s1.length());
        aobj = (new Object[] {
            i, s, abyte0
        });
        datainputstream;
        if(true)
        {
            break MISSING_BLOCK_LABEL_251;
        } else
        {
            Cls_16.mth_249(datainputstream);
            mth_66(fileconnection);
            fld_51 = aobj;
            return aobj;
        }
    }

    public final byte[] mth_50(String s, int i)
    {
        DataInputStream datainputstream;
        i = null;
        datainputstream = null;
        s;
        mth_58();
        JVM INSTR dup ;
        i;
        openDataInputStream();
        datainputstream;
        4;
        new byte[];
        s;
        int j = 0;
_L2:
        j;
        datainputstream;
        s;
        j;
        4 - j;
        read();
        JVM INSTR iadd ;
        JVM INSTR dup ;
        j;
        4;
        JVM INSTR icmplt 23;
           goto _L1 _L2
_L1:
        if(Cls_16.mth_677(s, 0) != 0x2d35510)
        {
            Cls_16.mth_249(datainputstream);
            mth_66(i);
            return null;
        }
        j = 0;
_L4:
        if(j >= 3)
            break; /* Loop/switch isn't completed */
        s;
        j;
        datainputstream;
        readByte();
        JVM INSTR bastore ;
        j++;
        if(true) goto _L4; else goto _L3
_L3:
        s;
        0;
        Cls_16.mth_668();
        JVM INSTR dup ;
        s;
        new byte[];
        byte abyte0[];
        abyte0;
        int k = 0;
_L7:
        if(k >= s) goto _L6; else goto _L5
_L5:
        k;
        datainputstream;
        abyte0;
        k;
        1024;
        s - k;
        Math.min();
        read();
        JVM INSTR iadd ;
        k;
          goto _L7
_L6:
        Cls_16.mth_249(datainputstream);
        mth_66(i);
        return abyte0;
        JVM INSTR pop ;
        Cls_16.mth_249(datainputstream);
        mth_66(i);
        return null;
        s;
        Cls_16.mth_249(datainputstream);
        mth_66(i);
        throw s;
    }

    public final long mth_51(String s)
    {
        long l;
        FileConnection fileconnection;
        l = -1;
        fileconnection = null;
        s;
        1;
        Connector.open();
        (FileConnection);
        JVM INSTR dup ;
        fileconnection;
        availableSize();
        s;
        mth_66(fileconnection);
        return s;
    }

    public final long mth_52(String s)
    {
        FileConnection fileconnection;
        s = Cls_16.mth_150(s);
        fileconnection = null;
        s;
        1;
        Connector.open();
        (FileConnection);
        JVM INSTR dup ;
        fileconnection;
        fileSize();
        long l;
        l;
        mth_66(fileconnection);
        return l;
        JVM INSTR pop ;
        mth_66(fileconnection);
        return (long)-1;
        s;
        mth_66(fileconnection);
        throw s;
    }

    public final int mth_53(byte abyte0[], String s, int i)
    {
        DataOutputStream dataoutputstream;
        String s1;
        i = null;
        dataoutputstream = null;
        s1 = null;
        if(abyte0 == null)
            break MISSING_BLOCK_LABEL_86;
        s;
        Cls_16.mth_150();
        JVM INSTR dup ;
        s1;
        2;
        Connector.open();
        (FileConnection);
        JVM INSTR dup ;
        i;
        create();
        break MISSING_BLOCK_LABEL_44;
        JVM INSTR pop ;
        i;
        mth_66();
        s1 = null;
        (dataoutputstream = i.openDataOutputStream()).writeInt(0x2d35510);
        dataoutputstream.writeByte(abyte0.length >> 16);
        dataoutputstream.writeShort(abyte0.length);
        dataoutputstream.write(abyte0);
        dataoutputstream.flush();
        Cls_16.mth_291(dataoutputstream);
        mth_66(i);
        return 0;
        Exception exception;
        exception;
        if(exception instanceof SecurityException)
        {
            Cls_16.mth_291(dataoutputstream);
            mth_66(i);
            return 2;
        }
        this;
        s1;
        mth_56();
        JVM INSTR pop ;
        Cls_16.mth_291(dataoutputstream);
        mth_66(i);
        return 1;
        abyte0;
        Cls_16.mth_291(dataoutputstream);
        mth_66(i);
        throw abyte0;
    }

    public final Cls_16 mth_54(String s, boolean flag, int i)
    {
        s = Cls_16.mth_150(s);
        if((i & 1) != 0 && (i & 2) != 0)
            i = 3;
        else
        if((i & 2) != 0)
            i = 2;
        else
            i = 1;
        s = (FileConnection)Connector.open(s, i);
        if(flag)
            s.create();
        return new Cls_16(s);
    }

    public Cls_6()
    {
    }

    public final boolean mth_55(String s)
    {
        boolean flag;
        FileConnection fileconnection;
        flag = false;
        fileconnection = null;
        Cls_16.mth_150(s);
        1;
        Connector.open();
        (FileConnection);
        JVM INSTR dup ;
        fileconnection;
        exists();
        JVM INSTR ifeq 31;
        flag = true;
    }

    public final void rootChanged(int i, String s)
    {
        Object obj;
        obj = Cls_16.fld_263.mth_641(s);
        if(i != 0)
            break MISSING_BLOCK_LABEL_115;
        i = 0;
        if(obj != null)
            break MISSING_BLOCK_LABEL_133;
        Cls_16.fld_263;
        Object obj1;
        Enumeration enumeration;
        obj = s;
        obj1 = System.getProperty("fileconn.dir.roots.names");
        obj1 = new Cls_16(((String) (obj1)), 0, 0);
        enumeration = FileSystemRegistry.listRoots();
_L4:
        if(!enumeration.hasMoreElements()) goto _L2; else goto _L1
_L1:
        String s1 = (String)enumeration.nextElement();
        if(!((Cls_16) (obj1)).mth_400()) goto _L4; else goto _L3
_L3:
        String s2 = ((Cls_16) (obj1)).mth_164();
        if(!s1.equals(obj)) goto _L4; else goto _L5
_L5:
        s2;
          goto _L6
_L2:
        null;
_L6:
        s;
        mth_227();
        obj = Cls_16.fld_263.mth_641(s);
        break MISSING_BLOCK_LABEL_133;
        if(i == 1)
        {
            i = 1;
            Cls_16.fld_263.mth_642(s);
        } else
        {
            return;
        }
        Cls_16.fld_263.mth_116(i, ((Cls_16) (obj)));
        return;
    }

    public final boolean mth_56(String s)
    {
        FileConnection fileconnection;
        s = Cls_16.mth_150(s);
        fileconnection = null;
        if(s == null)
            break MISSING_BLOCK_LABEL_33;
        s;
        length();
        JVM INSTR ifle 33;
           goto _L1 _L2
_L1:
        break MISSING_BLOCK_LABEL_18;
_L2:
        break MISSING_BLOCK_LABEL_33;
        (fileconnection = (FileConnection)Connector.open(s, 2)).delete();
        mth_66(fileconnection);
        return true;
    }

    public final boolean mth_57(String s)
    {
        FileConnection fileconnection;
        s = Cls_16.mth_150(s);
        fileconnection = null;
        s;
        3;
        Connector.open();
        (FileConnection);
        JVM INSTR dup ;
        fileconnection;
        exists();
        JVM INSTR ifne 31;
           goto _L1 _L2
_L1:
        break MISSING_BLOCK_LABEL_25;
_L2:
        break MISSING_BLOCK_LABEL_31;
        fileconnection.mkdir();
        mth_66(fileconnection);
        return true;
        JVM INSTR pop ;
        mth_66(fileconnection);
        return false;
        s;
        mth_66(fileconnection);
        throw s;
    }

    private static FileConnection mth_58(String s)
    {
        Cls_16.mth_150(s);
        1;
        Connector.open();
        (FileConnection);
        return;
        JVM INSTR pop ;
        return null;
    }

    public final String mth_59()
    {
        String s = System.getProperty("fileconn.dir.private");
        if("null".equals(s))
            return null;
        else
            return s;
    }

    public final String mth_60(Cls_16 cls_16, int i)
    {
        switch(i)
        {
        case 0: // '\0'
            cls_16 = "fileconn.dir.photos";
            break;

        case 1: // '\001'
            cls_16 = "fileconn.dir.videos";
            break;

        case 2: // '\002'
            cls_16 = "fileconn.dir.tones ";
            break;

        case 3: // '\003'
            cls_16 = "fileconn.dir.music";
            break;

        case 4: // '\004'
        case 5: // '\005'
        default:
            return null;
        }
        if((cls_16 = System.getProperty(cls_16)) == null || cls_16.equals("null"))
            return null;
        else
            return cls_16;
    }

    public final String mth_61(Cls_16 cls_16, String s)
    {
        if(s.startsWith("image"))
            return mth_60(cls_16, 0);
        if(s.startsWith("video"))
            return mth_60(cls_16, 1);
        if(s.startsWith("audio"))
            return mth_60(cls_16, 3);
        else
            return null;
    }

    public final void mth_62()
    {
        Object obj = System.getProperty("fileconn.dir.roots.names");
        obj = new Cls_16(((String) (obj)), 0, 0);
        Enumeration enumeration = FileSystemRegistry.listRoots();
        do
        {
            if(!enumeration.hasMoreElements())
                break;
            String s;
            String s1 = s = (String)enumeration.nextElement();
            if(((Cls_16) (obj)).mth_400())
                s1 = ((Cls_16) (obj)).mth_164();
            if(Cls_16.fld_263.mth_641(s) == null)
                Cls_16.fld_263.mth_227(s1, s);
        } while(true);
    }

    public final void mth_63()
    {
        if(!fld_50)
        {
            FileSystemRegistry.addFileSystemListener(this);
            fld_50 = true;
        }
    }

    public final Cls_16 mth_64()
    {
        return null;
    }

    public final int[] mth_65()
    {
        FileConnection fileconnection = null;
        int i;
        int ai1[];
        Enumeration enumeration1;
        fileconnection = (FileConnection)Connector.open(Cls_16.fld_263.mth_660(), 1);
        i = 0;
        Enumeration enumeration = fileconnection.list("*.obml15", true);
        do
        {
            if(!enumeration.hasMoreElements())
                break;
            if(Cls_16.mth_120((String)enumeration.nextElement()) != 0)
                i++;
        } while(true);
        ai1 = new int[i];
        enumeration1 = fileconnection.list("*.obml15", true);
_L4:
        if(!enumeration1.hasMoreElements()) goto _L2; else goto _L1
_L1:
        int j;
        if((j = Cls_16.mth_120((String)enumeration1.nextElement())) == 0) goto _L4; else goto _L3
_L3:
        ai1;
        --i;
        j;
        JVM INSTR iastore ;
          goto _L4
_L2:
        mth_66(fileconnection);
        return ai1;
        JVM INSTR pop ;
        0;
        new int[];
        int ai[];
        ai;
        mth_66(fileconnection);
        return ai;
        Exception exception;
        exception;
        mth_66(fileconnection);
        throw exception;
    }

    public static void mth_66(FileConnection fileconnection)
    {
        fileconnection;
        close();
        return;
    }
}